package com.chinaway.mobile.thread;

import java.util.UUID;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import com.chinaway.mobile.http.util.ConstantUtil;

public class ComplexThreadPool {
	private static final Integer Q_SIZE=2100;
	
	public static final ThreadPoolExecutor TASK_COMMISSION_POOL= new ThreadPoolExecutor(
			ConstantUtil.THREAD_COUNT, 
			ConstantUtil.THREAD_COUNT, 
			ConstantUtil.ALIVE_TIME, 
			TimeUnit.MINUTES, 
			new LinkedBlockingDeque<Runnable>(Q_SIZE), 
			new ThreadFactory() {
				@Override
				public Thread newThread(Runnable r) {
					return   new Thread(r,"MobileTask("+ UUID.randomUUID().toString()+")");
				}
			},
			new ThreadPoolExecutor.DiscardPolicy()
			);
}

